import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'
// import InsideRework from '@/views/productManagement/components/insideRework/index'

/* Router Modules */
// import componentsRouter from './modules/components'
// import chartsRouter from './modules/charts'
// import tableRouter from './modules/table'
// import nestedRouter from './modules/nested'

//  component: () => Promise.resolve({
//             name:'maintain',
//             components:{ProductModule},
//             render(h){
//               return h('ProductModule')
//             }
//           }),

//   'my-component': () => import('./my-async-component')
const vrTransform = (asyncCompFactory, name) => {
  return {
    // name,
    components: { [name]: asyncCompFactory },
    render(h) {
      return h(name)
    }
  }
}

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar
    noCache: true   a             if set true, the page will no be cached(default is false)
    affix: true                  if set true, the tag will affix in the tags-view
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [
      {
        path: 'dashboard',
        component: () => import('@/views/dashboard/index'),
        name: 'Dashboard',
        meta: { title: '首页', icon: 'dashboard' }
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },

  {
    path: '/print2DCodePage',
    name: 'print2DCodePage',
    component: () => import('@/components/azure/PrintCode/Print2DCode'),
    hidden: true
  },
  {
    path: '/printOrderCode',
    name: 'printOrderCode',
    component: () => import('@/components/azure/PrintCode/PrintOrderCode'),
    hidden: true
  },
  {
    path: '/printPDF',
    name: 'printPDF',
    component: () => import('@/components/azure/PrintCode/PrintPDF'),
    hidden: true
  },

  //  template  makeupTemplate.vue

  // {
  //   path: '/404',
  //   component: () => import('@/views/error-page/404'),
  //   hidden: true
  // },
  // {
  //   path: '/401',
  //   component: () => import('@/views/error-page/401'),
  //   hidden: true
  // },
  // {
  //   path: '/',
  //   component: Layout,
  //   redirect: '/dashboard',
  //   children: [
  //     {
  //       path: 'dashboard',
  //       component: () => import('@/views/dashboard/index'),
  //       name: 'Dashboard',
  //       meta: { title: '首页', icon: 'dashboard'}
  //     }
  //   ]
  // },

  // {
  //   path: '',
  //   component: Layout,
  //   redirect: '/profile/index',
  //   hidden: true,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/profile/index'),
  //       name: 'Profile',
  //       meta: { title: 'Profile', icon: 'user', noCache: true }
  //     }
  //   ]
  // },
  // {
  //   path: '',
  //   component: Layout,
  //   redirect: '/user/personage',
  //   alwaysShow: true,
  //   meta: { title: '系统管理', icon: 'dashboard' },
  //   children: [
  //     {
  //       path: '/user',
  //       name: 'user',
  //       redirect: '/user/personage',
  //       component: () => import('@/views/system/user/index'),
  //       meta: { title: '用户管理', icon: 'dashboard' },
  //       children:[
  //         {
  //           path: '/user/personage',
  //           name: 'customerConsumption',
  //           component: () => import('@/views/system/user/personage'),
  //           meta: { title: '个人中心', icon: 'dashboard' }
  //         },
  //         {
  //           path: '/user/userControl',
  //           name: 'userControl',
  //           component: () => import('@/views/system/user/userControl'),
  //           meta: { title: '用户管理', icon: 'dashboard' }
  //         },
  //         {
  //           path: '/user/role',
  //           name: 'role',
  //           component: () => import('@/views/system/user/role'),
  //           meta: { title: '角色管理', icon: 'dashboard' }
  //         },
  //         {
  //           path: '/user/organization',
  //           name: 'organization',
  //           component: () => import('@/views/system/user/organization'),
  //           meta: { title: '组织管理', icon: 'dashboard' }
  //         },
  //         {
  //           path: '/user/jurisdiction',
  //           name: 'jurisdiction',
  //           component: () => import('@/views/system/user/jurisdiction'),
  //           meta: { title: '权限管理', icon: 'dashboard' }
  //         },
  //         {
  //           path: '/user/online',
  //           name: 'online',
  //           component: () => import('@/views/system/user/online'),
  //           meta: { title: '在线用户管理', icon: 'dashboard' }
  //         }
  //       ]
  //     },
  //     {
  //       path: '/menu',
  //       name: 'menu',
  //       component: () => import('@/views/system/menu'),
  //       meta: { title: '菜单管理', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/notice',
  //       name: 'notice',
  //       component: () => import('@/views/system/notice'),
  //       meta: { title: '公告管理', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/news',
  //       name: 'news',
  //       component: () => import('@/views/system/news'),
  //       meta: { title: '消息中心', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/journal',
  //       name: 'journal',
  //       component: () => import('@/views/system/journal'),
  //       meta: { title: '系统日志', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/parameter',
  //       name: 'parameter',
  //       component: () => import('@/views/system/parameter'),
  //       meta: { title: '系统参数设置', icon: 'dashboard' }
  //     }
  //   ]
  // },

  //  只是暂时用来做编辑和新增的跳转
  // {
  //   path: '/baseproduct',
  //   redirect: 'baseproductinfo',
  //   component: Layout,
  //   // hidden: true,
  //   // alwaysShow: true,
  //   meta: { title: '产品资料', icon: 'dashboard' },
  //   children: [
  //     {
  //       path: 'createProductInfo',
  //       name: 'createProductInfo',
  //       component: () => import('@/views/baseproduct/createProductInfo.vue'),
  //       meta: { title: '产品基本信息新增', icon: 'dashboard' },
  //       hidden: true
  //     },

  // {
  //   path: 'productSync',
  //   name: 'productSync',
  //   component: () => import('@/views/baseproduct/productSync.vue'),
  //   meta: { title: '产品同步', icon: 'dashboard' }
  // },

  //
  //     {
  //       path: 'editProductInfo',
  //       name: 'editProductInfo',
  //       component: () => import('@/views/baseproduct/editProductInfo.vue'),
  //       meta: { title: '产品基本信息修改', icon: 'dashboard' },
  //       hidden: true
  //     },
  //
  //
  //     {
  //       path: 'componentModify',
  //       name: 'componentModify',
  //       component: () => import('@/views/baseproduct/componentModify'),
  //       meta: { title: '组件新增修改', icon: 'dashboard' },
  //       hidden: true
  //     }
  //   ]
  // },

  {
    path: '',
    component: Layout,
    alwaysShow: true,
    meta: { title: 'BOM主数据', icon: 'dashboard' },
    children: [
      {
        path: '/makeupTemplate',
        name: 'makeupTemplate',
        component: () => import('@/views/makeupTemplate/makeupTemplate'),
        // hidden: true
        meta: { title: '全部模板', icon: 'dashboard' }
      },

      {
        path: '/modifyMakeupTemplate',
        name: 'modifyMakeupTemplate',
        component: () => import('@/views/makeupTemplate/modifyMakeupTemplate'),
        hidden: true,
        meta: { title: '编辑拼版', icon: 'dashboard' }
      },

      {
        path: '/material',
        name: 'bomMaterial',
        component: () => import('@/views/bom/bomMaterial'),
        meta: { title: '产品资料', icon: 'dashboard' }
      },
      {
        path: '/product',
        name: 'bomProduct',
        component: () => import('@/views/bom/bomProduct'),
        meta: { title: '物料', icon: 'dashboard' }
      },
      {
        path: '/bom',
        name: 'bom',
        component: () => import('@/views/bom/bom'),
        meta: { title: 'BOM', icon: 'dashboard' }
      },
      {
        path: '/document',
        name: 'bomDocument',
        component: () => import('@/views/bom/bomDocument'),
        meta: { title: '组件管理', icon: 'dashboard' }
      },
      {
        path: '/specification',
        name: 'bomSpecification',
        component: () => import('@/views/bom/bomSpecification'),
        meta: { title: '规格信息', icon: 'dashboard' }
      },
      {
        path: '/auditor',
        name: 'bomAuditor',
        component: () => import('@/views/bom/auditor'),
        meta: { title: '物品审核', icon: 'dashboard' }
      },
      {
        path: '/bomClassify',
        name: 'bomClassify',
        component: () => import('@/views/bom/bomClassify'),
        meta: { title: '尺寸分类', icon: 'dashboard' }
      },
      {
        path: '/bomDetail',
        name: 'bomDetail',
        component: () => import('@/views/bom/bomDetail'),
        meta: { title: '尺寸明细', icon: 'dashboard' }
      }

      // {
      //   path: '/sorting',
      //   name: 'sorting',
      //   component: () => import('@/views/productManagement/sorting'),
      //   meta: { title: '产品分拣', icon: 'dashboard' }
      // }
    ]
  },

  // {
  //   path: '/productManagement',
  //   component: Layout,
  //   redirect: '/startWorking',
  //   alwaysShow: true,
  //   meta: { title: '生产管理', icon: 'dashboard' },
  //   children: [
  //     //     {
  //     //       path: '/startWorking',
  //     //       name: 'startWorking',
  //     //       component: () => import('@/views/productManagement/startWorking'),
  //     //       meta: { title: '生产开工', icon: 'dashboard' }
  //     //     },
  //     //     {
  //     //       path: '/scan',
  //     //       name: 'scan',
  //     //       component: () => import('@/views/productManagement/scan'),
  //     //       meta: { title: '过站扫描', icon: 'dashboard' }
  //     //     },
  //     //     {
  //     //       path: '/output',
  //     //       name: 'output',
  //     //       component: () => import('@/views/productManagement/output'),
  //     //       meta: { title: '输出分拣', icon: 'dashboard' }
  //     //     },
  //     //
  //     // {
  //     //   path: '/maintain',
  //     //   name: 'maintain',
  //     //   component: () => import('@/views/productManagement/maintain'),
  //     //   component: () => new Promise((resolve, reject) => {
  //     //     const InsideRework = import('@/views/productManagement/components/insideRework/index')
  //     //     resolve({
  //     //       // name: 'maintain',
  //     //       components: {
  //     //         InsideRework
  //     //       },
  //     //       render(h) {
  //     //         return h('InsideRework')
  //     //       }
  //     //     })
  //     //   }),
  //     //
  //     //   meta: { title: '维修申请', icon: 'dashboard' }
  //     // },
  //     //
  //     // {
  //     //   path: '/maintainTreatment',
  //     //   name: 'maintainTreatment',
  //     //   component: () => import('@/views/productManagement/maintainTreatment'),
  //     //   meta: { title: '维修处理', icon: 'dashboard' }
  //     // }
  //     //     {
  //     //       path: '/sorting',
  //     //       name: 'sorting',
  //     //       component: () => import('@/views/productManagement/sorting'),
  //     //       meta: { title: '产品分拣', icon: 'dashboard' }
  //     //     },
  //     //     {
  //     //       path: '/shipments',
  //     //       name: 'shipments',
  //     //       component: () => import('@/views/productManagement/shipments'),
  //     //       meta: { title: '包装发货', icon: 'dashboard' }
  //     //     }
  //     {
  //       path: '/insidePagesVolume',
  //       name: 'insidePagesVolume',
  //       component: () => import('@/views/productManagement/insidePagesVolume'),
  //       meta: { title: '内页册成册', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/halfFinishedGoodsTest',
  //       name: 'halfFinishedGoodsTest',
  //       component: () => import('@/views/productManagement/halfFinishedGoodsTest'),
  //       meta: { title: '半成品质检', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/coverDesign',
  //       name: 'coverDesign',
  //       component: () => import('@/views/productManagement/coverDesign'),
  //       meta: { title: '封面制作', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/coverTest',
  //       name: 'coverTest',
  //       component: () => import('@/views/productManagement/coverTest'),
  //       meta: { title: '封面质检', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/productMerge',
  //       name: 'productMerge',
  //       component: () => import('@/views/productManagement/productMerge'),
  //       meta: { title: '产品合册', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/productCover',
  //       name: 'productCover',
  //       component: () => import('@/views/productManagement/productCover'),
  //       meta: { title: '产品装封面', icon: 'dashboard' }
  //     },
  //   ]
  // },
  {
    path: '/productStat',
    component: Layout,
    redirect: '/productStat',
    meta: { title: '生产统计',icon:'dashboard'},
    alwaysShow: 'true',
    children: [
      {
        path: '/productionStat',
        name: 'productionStat',
        component: () => import('@/views/productManagement/productionStat'),
        meta: { title: '生产统计', icon: 'dashboard' }
      },
      {
        path: '/productBusinessStat',
        name: 'productBusinessStat',
        component: () => import('@/views/productManagement/productBusinessStat'),
        meta: { title: '生产营业统计', icon: 'dashboard' }
      }
    ]
  },

  // {
  //   path: '',
  //   component: Layout,
  //   redirect: '/process',
  //   alwaysShow: true,
  //   meta: { title: '工艺管理', icon: 'dashboard' },
  //   children: [
  //     {
  //       path: '/process',
  //       name: 'process',
  //       component: () => import('@/views/technology/process'),
  //       meta: { title: '工序设置', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/station',
  //       name: 'station',
  //       component: () => import('@/views/technology/station'),
  //       meta: { title: '工位设置', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/technology',
  //       name: 'technology',
  //       component: () => import('@/views/technology/technology'),
  //       meta: { title: '工艺路线设置', icon: 'dashboard' }
  //     },
  //   ]
  // },
  // {
  //   path: '',
  //   component: Layout,
  //   redirect: '/upkeep',
  //   children: [
  //     {
  //       path: '/upkeep',
  //       name:'upkeep',
  //       component: () => import('@/views/maintain/upkeep'),
  //       meta: { title: '工程维护', icon: 'dashboard' }
  //     }
  //   ]
  // },
  {
    path: '/basics',
    component: Layout,
    redirect: '/workshop',
    alwaysShow: true,
    meta: { title: '基础资料', icon: 'dashboard' },
    children: [
      // {
      //   path: '/workshop',
      //   name: 'workshop',
      //   component: () => import('@/views/basics/workshop'),
      //   meta: { title: '车间', icon: 'dashboard' }
      // },
      // {
      //   path: '/LineBody',
      //   name: 'LineBody',
      //   component: () => import('@/views/basics/LineBody'),
      //   meta: { title: '线体', icon: 'dashboard' }
      // },
      // {
      //   path: '/facility',
      //   name: 'facility',
      //   component: () => import('@/views/basics/facility'),
      //   meta: { title: '设备', icon: 'dashboard' }
      // },
      // {
      //   path: '/warehouse',
      //   name: 'warehouse',
      //   component: () => import('@/views/basics/warehouse'),
      //   meta: { title: '仓库', icon: 'dashboard' }
      // },

      {
        path: '/badReasons',
        name: 'badReasons',
        component: () => import('@/views/basics/badReasons'),
        meta: { title: '不良原因', icon: 'dashboard' }
      },
      {
        path: '/badReasonsDetail',
        name: 'badReasonsDetail',
        hidden: true, // (默认 false)
        component: () => import('@/views/basics/badReasonsDetail'),
        meta: { title: '不良原因细类', icon: 'dashboard' }
      },
      {
        path: '/reworkSolution',
        name: 'reworkSolution',
        component: () => import('@/views/basics/reworkSolution'),
        meta: { title: '返工解决方法', icon: 'dashboard' }
      },
      {
        path: '/StorageConfig',
        name: 'StorageConfig',
        component: () => import('@/views/basics/StorageConfig'),
        meta: { title: '储位配置', icon: 'dashboard' }
      }
    ]
  }
  // {
  //   path: '',r
  //   component: Layout,
  //   redirect: '/query',
  //   children: [
  //     {
  //       path: '/query',
  //       name:'query',
  //       component: () => import('@/views/queryPivot/query'),
  //       meta: { title: '数据查询', icon: 'dashboard' }
  //     }
  //   ]
  // }
]

/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
// export const asyncRoutes = [
  // {
  //   path: '/',
  //   component: Layout,
  //   redirect: '/dashboard',
  //   children: [
  //     {
  //       path: 'dashboard',
  //       component: () => import('@/views/dashboard/index'),
  //       name: 'Dashboard',
  //       meta: { title: '首页', icon: 'dashboard' }
  //     }
  //   ]
  // },
  // {
  //   path: '/regulation',
  //   component: Layout,
  //   redirect: '/strategy',
  //   children: [
  //     {
  //       path: '/strategy',
  //       component: () => import('@/views/regulation/strategy'),
  //       name: 'strategy',
  //       meta: { title: '规则策略', icon: 'dashboard' }
  //     }
  //   ]
  // },
  // {
  //   path: '/system',
  //   component: Layout,
  //   redirect: '/user/personage',
  //   alwaysShow: true,
  //   meta: { title: '系统管理', icon: 'dashboard' },
  //   children: [
  //     {
  //       path: '/user',
  //       name: 'user',
  //       redirect: '/user/personage',
  //       component: () => import('@/views/system/user/index'),
  //       meta: { title: '用户管理', icon: 'dashboard' },
  //       children:[
  //         {
  //           path: '/user/personage',
  //           name: 'customerConsumption',
  //           component: () => import('@/views/system/user/personage'),
  //           meta: { title: '个人中心', icon: 'dashboard' }
  //         },
  //         {
  //           path: '/user/userControl',
  //           name: 'userControl',
  //           component: () => import('@/views/system/user/userControl'),
  //           meta: { title: '用户管理', icon: 'dashboard' }
  //         },
  //         {
  //           path: '/user/role',
  //           name: 'role',
  //           component: () => import('@/views/system/user/role'),
  //           meta: { title: '角色管理', icon: 'dashboard' }
  //         },
  //         {
  //           path: '/user/organization',
  //           name: 'organization',
  //           component: () => import('@/views/system/user/organization'),
  //           meta: { title: '组织管理', icon: 'dashboard' }
  //         },
  //         {
  //           path: '/user/jurisdiction',
  //           name: 'jurisdiction',
  //           component: () => import('@/views/system/user/jurisdiction'),
  //           meta: { title: '权限管理', icon: 'dashboard' }
  //         },
  //         {
  //           path: '/user/online',
  //           name: 'online',
  //           component: () => import('@/views/system/user/online'),
  //           meta: { title: '在线用户管理', icon: 'dashboard' }
  //         }
  //       ]
  //     },
  //     {
  //       path: '/menu',
  //       name: 'menu',
  //       component: () => import('@/views/system/menu'),
  //       meta: { title: '菜单管理', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/notice',
  //       name: 'notice',
  //       component: () => import('@/views/system/notice'),
  //       meta: { title: '公告管理', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/news',
  //       name: 'news',
  //       component: () => import('@/views/system/news'),
  //       meta: { title: '消息中心', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/journal',
  //       name: 'journal',
  //       component: () => import('@/views/system/journal'),
  //       meta: { title: '系统日志', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/parameter',
  //       name: 'parameter',
  //       component: () => import('@/views/system/parameter'),
  //       meta: { title: '系统参数设置', icon: 'dashboard' }
  //     }
  //   ]
  // },
  // {
  //   path: '/production',
  //   component: Layout,
  //   redirect: '/project',
  //   alwaysShow: true,
  //   meta: { title: '生产排产', icon: 'dashboard' },
  //   children: [
  //     {
  //       path: '/project',
  //       name: 'project',
  //       component: () => import('@/views/production/project'),
  //       meta: { title: '订单管理', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/order',
  //       name: 'order',
  //       component: () => import('@/views/production/order'),
  //       meta: { title: '订单排产', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/picking',
  //       name: 'picking',
  //       component: () => import('@/views/production/picking'),
  //       meta: { title: '生产领料', icon: 'dashboard' }
  //     },
  //     // {
  //     //   path: '/workOrder',
  //     //   name: 'workOrder',
  //     //   component: () => import('@/views/production/workOrder'),
  //     //   meta: { title: '工单管理', icon: 'dashboard' }
  //     // },
  //     {
  //       path: '/schedule',
  //       name: 'schedule',
  //       component: () => import('@/views/production/schedule'),
  //       meta: { title: '排程管理', icon: 'dashboard' }
  //     }
  //   ]
  // },
  // {
  //   path: '/productManagement',
  //   component: Layout,
  //   redirect: '/startWorking',
  //   alwaysShow: true,
  //   meta: { title: '生产管理', icon: 'dashboard' },
  //   children: [
  //     {
  //       path: '/startWorking',
  //       name: 'startWorking',
  //       component: () => import('@/views/productManagement/startWorking'),
  //       meta: { title: '生产开工', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/scan',
  //       name: 'scan',
  //       component: () => import('@/views/productManagement/scan'),
  //       meta: { title: '过站扫描', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/output',
  //       name: 'output',
  //       component: () => import('@/views/productManagement/output'),
  //       meta: { title: '输出分拣', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/maintain',
  //       name: 'maintain',
  //       component: () => import('@/views/productManagement/maintain'),
  //       meta: { title: '维修处理', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/sorting',
  //       name: 'sorting',
  //       component: () => import('@/views/productManagement/sorting'),
  //       meta: { title: '产品分拣', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/shipments',
  //       name: 'shipments',
  //       component: () => import('@/views/productManagement/shipments'),
  //       meta: { title: '包装发货', icon: 'dashboard' }
  //     }
  //   ]
  // },
  // {
  //   path: '/technology',
  //   component: Layout,
  //   redirect: '/process',
  //   alwaysShow: true,
  //   meta: { title: '工艺管理', icon: 'dashboard' },
  //   children: [
  //     {
  //       path: '/process',
  //       name: 'process',
  //       component: () => import('@/views/technology/process'),
  //       meta: { title: '工序设置', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/station',
  //       name: 'station',
  //       component: () => import('@/views/technology/station'),
  //       meta: { title: '工位设置', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/technology',
  //       name: 'technology',
  //       component: () => import('@/views/technology/technology'),
  //       meta: { title: '工艺路线设置', icon: 'dashboard' }
  //     },
  //   ]
  // },
  // {
  //   path: '/maintain',
  //   component: Layout,
  //   redirect: '/upkeep',
  //   children: [
  //     {
  //       path: '/upkeep',
  //       name:'upkeep',
  //       component: () => import('@/views/maintain/upkeep'),
  //       meta: { title: '工程维护', icon: 'dashboard' }
  //     }
  //   ]
  // },
  // ,{
  //   path: '/basics',
  //   component: Layout,
  //   redirect: '/workshop',
  //   alwaysShow: true,
  //   meta: { title: '基础资料', icon: 'dashboard' },
  //   children: [
  //     {
  //       path: '/workshop',
  //       name: 'workshop',
  //       component: () => import('@/views/basics/workshop'),
  //     meta: { title: '车间', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/LineBody',
  //       name: 'LineBody',
  //       component: () => import('@/views/basics/LineBody'),
  //     meta: { title: '线体', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/facility',
  //       name: 'facility',
  //       component: () => import('@/views/basics/facility'),
  //     meta: { title: '设备', icon: 'dashboard' }
  //     },
  //     {
  //       path: '/warehouse',
  //       name: 'warehouse',
  //       component: () => import('@/views/basics/warehouse'),
  //     meta: { title: '仓库', icon: 'dashboard' }
  //     }
  //   ]
  // }
  // {
  //   path: '/queryPivot',
  //   component: Layout,
  //   redirect: '/query',
  //   children: [
  //     {
  //       path: '/query',
  //       name:'query',
  //       component: () => import('@/views/queryPivot/query'),
  //       meta: { title: '数据查询', icon: 'dashboard' }
  //     }
  //   ]
  // },
  // 404 page must be placed at the end !!!
  // { path: '*', redirect: '/404', hidden: true }
// ]

const createRouter = () => new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes
  })

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
